package book;

/**
 * 书的实体类，包括书的属性和借阅状态
 */
public class Book {
    //书名
    private String name;
    //作者
    private String author;
    //书的价格
    private double price;
    //书的种类
    private String type;
    //书的节约状态
    private boolean isBorrowed;

    //构造方法，用于初始化节约状态就是默认的false，不用初始化
    public Book(String name,String author,double price,String type){
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    //书名和作者只有get方法
    public String getName() {
        return name;
    }

    public String getAuthor() {
        return author;
    }

    //get set
    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isBorrowed() {
        return isBorrowed;
    }

    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    //toString进行输出
    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +
                ", isBorrowed=" + isBorrowed +
                '}';
    }
}
